<template>
	<view class="stockDetail">
		<view class="box" v-for="(item,index) in dataList" :key='index'>
			<view class="box-title ">产品条码：{{item.num1}}</view>
			<view class="box-item">
				<image class="item-img" :src="item.img" @error="(e)=>onErrorImg(e,index)"></image>
				<view class="item-cont">
					<text class="cont-tit u-line-1">{{item.product_name}}</text>
					<text class="tip mb-10 u-line-1">商品属性:{{item.stock_name}}</text>
					<text class="tip mb-10 u-line-1">{{type==1?'出库':'入库'}}数量:{{item.num}}</text>
					<text class="tip u-line-1">库存:{{item.stock_num}}</text>
				</view>
			</view>
			<view class="btn-box">
				<view class="tip u-line-2">备注:<text style="margin-left: 20rpx;">{{item.remark?item.remark:'暂无'}}</text></view>
			</view>
		</view>
	</view>
</template>

<script>
	export default{
		data(){
			return{
				dataList:[],
				type:''
			}
		},
		onLoad(options){
			if(options.index){
				let page = getCurrentPages()
				let currentPage = page[page.length-2]
				// console.log(currentPage.$vm.dataList[options.index].detailed)
				this.type = options.type
				this.dataList = currentPage.$vm.dataList[options.index].detailed
			}
		},
		methods:{
			onErrorImg(e,index){
				this.dataList[index].img = require('../../static/nopic2.png')
			},
		}
	}
</script>
<style>
	page{
		background-color: #f5f5f5;
	}
</style>
<style lang="scss" scoped>
	.stockDetail{
		.tip{
			color: #999999;
		}
		.mb-10{
			margin-bottom: 10rpx;
		}
		.box{
			background-color: #fff;
			width: 690rpx;
			margin:20rpx 30rpx ;
			border-radius: 20rpx;
			padding: 20rpx;
			.box-title{
				margin-bottom: 20rpx;
				position: relative;
				&::after{
					content: '';
					width: 10rpx;
					height: 28rpx;
					background-color: #3297ef;
					position: absolute;
					left: -20rpx;
					top: 6rpx;
				}
			}
			.box-item{
				display: flex;
				padding: 30rpx 0;
				border-top: 1px solid #f8f8f8;
				border-bottom: 1px solid #f8f8f8;
				.item-img{
					width: 320rpx;
					height: 175rpx;
				}
				.item-cont{
					display: flex;
					flex-direction: column;
					margin-left: 20rpx;
					width: 100%;
					.cont-tit{
						font-size: 28rpx;
						font-weight: bold;
						padding-bottom: 40rpx;
					}
					
				}
			}
			.btn-box{
				padding: 30rpx 0 10rpx;
			}
		}
	}
</style>
